{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 1. 项目介绍\n",
    "\n",
    "  - 项目是由模块组成、有特定功能的程序。它能够满足用户的直接使用需求，例如[古诗词生成器](https://momodel.cn/explore/5bfb634e1afd943c623dd9cf?type=app&tab=1)、[风格迁移](https://momodel.cn/explore/5bfb634e1afd943c623dd9cf?type=app&tab=1)等。\n",
    "  - 开发项目过程中你可以导入数据集，也可以通过每个 cell 上方工具栏的`<+>`直接插入[模块](https://momodel.cn/modules)和代码块。\n",
    "  - 你可以将开发好的项目进行[部署](https://momodel.cn/docs/#/zh-cn/%E5%BC%80%E5%8F%91%E5%92%8C%E9%83%A8%E7%BD%B2%E4%B8%80%E4%B8%AA%E5%BA%94%E7%94%A8%EF%BC%88app%EF%BC%89)，项目部署成功并选择正式版本发布后会展示在“项目”页面，用户可以在线使用，也可以通过 API 调用。\n",
    "\n",
    "  - 项目目录结构:\n",
    "\n",
    "    - ```results```*-----结果的文件存放地(如果你运行 job，务必将运行结果指定在此目录)*\n",
    "    - ```_OVERVIEW.md``` *-----项目的相关介绍*\n",
    "    - ```_README.md```*-----说明文档*\n",
    "    - ```app_spec.yml```*-----定义项目的输入输出，为部署服务*\n",
    "    - ```coding_here.ipynb```*-----输入并运行代码*"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def handle(conf):\n",
    "    \"\"\"\n",
    "    该方法是部署之后，其他人调用你的服务时候的处理方法。\n",
    "    请按规范填写参数结构，这样我们就能替你自动生成配置文件，方便其他人的调用。\n",
    "    范例：\n",
    "    params['key'] = value # value_type: str # description: some description\n",
    "    value_type 可以选择：img, video, audio, str, int, float, [int], [str], [float]\n",
    "    参数请放到params字典中，我们会自动解析该变量。\n",
    "    \"\"\"\n",
    "\n",
    "    param1 = conf['param1']  # value_type: str # description: some description\n",
    "    # add your code\n",
    "    return {'ret1': 'cat'}\n",
    "    "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "\n",
    "## 2. 开发环境简介\n",
    "\n",
    "你当前所在的页面 Notebook 是一个内嵌 JupyterLab 的在线类 IDE 编程环境，开发过程中可以使用页面右侧的 API 文档进行快速查询。Notebook 有以下主要功能：\n",
    "\n",
    "- [调用数据集、模块和代码块资源](https://momodel.cn/docs/#/zh-cn/%E5%A6%82%E4%BD%95%E5%AF%BC%E5%85%A5%E5%B9%B6%E4%BD%BF%E7%94%A8%E6%A8%A1%E5%9D%97%E5%92%8C%E6%95%B0%E6%8D%AE%E9%9B%86)\n",
    "- [多人代码协作](https://momodel.cn/docs/#/zh-cn/%E5%9C%A8Mo%E8%BF%90%E8%A1%8C%E4%BD%A0%E7%9A%84%E7%AC%AC%E4%B8%80%E6%AE%B5%E4%BB%A3%E7%A0%81?id=_7-%e4%bd%a0%e5%8f%af%e4%bb%a5%e9%82%80%e8%af%b7%e5%a5%bd%e5%8f%8b%e8%bf%9b%e8%a1%8c%e5%8d%8f%e4%bd%9c)\n",
    "- [在 GPU 资源上训练机器学习模型](https://momodel.cn/docs/#/zh-cn/%E5%9C%A8GPU%E6%88%96CPU%E8%B5%84%E6%BA%90%E4%B8%8A%E8%AE%AD%E7%BB%83%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E6%A8%A1%E5%9E%8B)\n",
    "- [简单部署](https://momodel.cn/docs/#/zh-cn/%E5%BC%80%E5%8F%91%E5%92%8C%E9%83%A8%E7%BD%B2%E4%B8%80%E4%B8%AA%E5%BA%94%E7%94%A8%EF%BC%88app%EF%BC%89)\n",
    "\n",
    "快来动手试试吧！点击左侧工具栏的新建文件图标即可选择你需要的文件类型。\n",
    "\n",
    "<img src='https://imgbed.momodel.cn/006tNc79gy1g61agfcv23j31c30u0789.jpg' width=100% height=100%>\n",
    "\n",
    "\n",
    "\n",
    "左侧和右侧工具栏都可根据使用需要进行收合。\n",
    "<img src='https://imgbed.momodel.cn/collapse_tab.2019-09-06 11_07_44.gif' width=100% height=100%>"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 3. 快捷键与代码补全\n",
    "Mo Notebook 已完全采用 Jupyter Notebook 的原生快捷键，并且支持 `tab` 代码补全。\n",
    "\n",
    "运行代码：`shift` + `enter` 或者 `shift` + `return`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 4. 常用指令介绍\n",
    "\n",
    "- 解压上传后的文件\n",
    "\n",
    "在 cell 中输入并运行以下命令：\n",
    "```!7zx file_name.zip```\n",
    "\n",
    "- 查看所有包（package）\n",
    "\n",
    "`!pip list --format=columns`\n",
    "\n",
    "- 检查是否已有某个包\n",
    "\n",
    "`!pip show package_name`\n",
    "\n",
    "- 安装缺失的包\n",
    "\n",
    "`!pip install package_name`\n",
    "\n",
    "- 更新已有的包\n",
    "\n",
    "`!pip install package_name --upgrade`\n",
    "\n",
    "\n",
    "- 使用包\n",
    "\n",
    "`import package_name`\n",
    "\n",
    "- 显示当前目录下的档案及目录\n",
    "\n",
    "`ls`\n",
    "\n",
    "- 使用引入的数据集\n",
    "\n",
    "数据集被引入后存放在 datasets 文件夹下，注意，这个文件夹是只读的，不可修改。如果需要修改，可在 Notebook 中使用\n",
    "\n",
    "`!cp -R ./datasets/<imported_dataset_dir>  ./<your_folder>`\n",
    "\n",
    "指令将其复制到其他文件夹后再编辑，对于引入的数据集中的 zip 文件，可使用\n",
    "\n",
    "`!7zx ./datasets/<imported_dataset_dir>/<XXX.zip> ./<your_folder>`\n",
    "\n",
    "指令解压缩到其他文件夹后使用"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 5. 其他可参考资源\n",
    "- [帮助文档](https://momodel.cn/docs/#/)：基本页面介绍和常见问题都可以在里面找到\n",
    "- [平台功能教程](https://momodel.cn/classroom/class?id=5c5696cd1afd9458d456bf54&type=doc)：通过图文结合的 Notebook 详细介绍开发环境基本功能和操作\n",
    "- [吴恩达机器学习](https://momodel.cn/classroom/class?id=5c5696191afd94720cc94533&type=video)：机器学习经典课程\n",
    "- [李宏毅机器学习](https://s.momodel.cn/classroom/class?id=5d40fdafb5113408a8dbb4a1&type=video)：中文世界最好的机器学习课程\n",
    "- [机器学习实战](https://momodel.cn/classroom/class?id=5c680b311afd943a9f70901b&type=practice)：通过实操指引完成独立的模型，掌握相应的机器学习知识\n",
    "- [Python 教程](https://momodel.cn/classroom/class?id=5d1f3ab81afd940ab7d298bf&type=notebook)：简单易懂的 Python 新手教程\n",
    "- [模块开发](https://momodel.cn/modules)：关于模型训练、开发与部署的高阶教程"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  },
  "pycharm": {
   "stem_cell": {
    "cell_type": "raw",
    "metadata": {
     "collapsed": false
    },
    "source": []
   }
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
